#ifndef _MTYPES_H
#define _MTYPES_H

#include "utils.h"

typedef int ntyp;
typedef double ftyp;

class fcomplex
{
public:
	double re;
	double im;

	fcomplex(double x, double y) { re=x, im=y; }
	fcomplex(double x) { re=x, im=0.; }
	fcomplex() { re=0., im=0.; }

	fcomplex operator*(const fcomplex& a) {
		fcomplex ret(re*a.re-im*a.im, re*a.im+im*a.re);
		return ret;
	}
	fcomplex operator*(double a) {
		fcomplex ret(re*a, im*a);
		return ret;
	}
	fcomplex operator/(double a) {
		fcomplex ret(re/a, im/a);
		return ret;
	}
	fcomplex operator+(const fcomplex& a) {
		fcomplex ret(re+a.re, im+a.im);
		return ret;
	}
	fcomplex operator-(const fcomplex& a) {
		fcomplex ret(re-a.re, im-a.im);
		return ret;
	}

	fcomplex& operator=(const fcomplex& a) { re=a.re; im=a.im; return *this; }

	void setRe(double a) { re=a; }
	void setIm(double a) { im=a; }

};

class Point
{
public:
	double x, y, z;

	Point(double _x, double _y, double _z) : x(_x), y(_y), z(_z) { }
	Point() { }
};

string itoa(int k)
{
	string ret="";
	do {
		ret = (char)(k%10+'0')+ret;
		k/=10;
	}
	while(k>0);
	return ret;
}

#endif
